package com.che.software.testato.domain.dao;

import java.util.List;

import com.che.software.testato.domain.dao.jdbc.exception.VariantCreationDAOException;
import com.che.software.testato.domain.dao.jdbc.exception.VariantSearchDAOException;
import com.che.software.testato.domain.dao.jdbc.exception.VariantUpdateDAOException;
import com.che.software.testato.domain.entity.Variant;
import com.che.software.testato.domain.entity.creation.VariantCreation;
import com.che.software.testato.domain.entity.search.VariantSearch;

/**
 * DAO interface dedicated to the variants management.
 * 
 * @author Clement HELIOU (clement.heliou@che-software.com).
 * @copyright Che Software.
 * @license GNU General Public License.
 * @since July, 2011.
 * 
 *        This file is part of Testato.
 * 
 *        Testato is free software: you can redistribute it and/or modify it
 *        under the terms of the GNU General Public License as published by the
 *        Free Software Foundation, either version 3 of the License, or (at your
 *        option) any later version.
 * 
 *        Testato is distributed in the hope that it will be useful, but WITHOUT
 *        ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 *        FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
 *        for more details.
 * 
 *        You should have received a copy of the GNU General Public License
 *        along with Testato. If not, see <http://www.gnu.org/licenses/>.
 * 
 *        Testato's logo is a creation of Arrioch
 *        (http://arrioch.deviantart.com/) and it's distributed under the terms
 *        of the Creative Commons License.
 */
public interface IVariantDAO {

	/**
	 * Checks if variants are already existing or not for a given test case.
	 * 
	 * @author Clement HELIOU (clement.heliou@che-software.com).
	 * @param testCaseId the test case id.
	 * @return true if variants are already existing, else false.
	 * @since July, 2011.
	 * @throws VariantSearchDAOException if an error occurs during the search.
	 */
	public boolean areVariantsExistingFromTestCaseId(int testCaseId) throws VariantSearchDAOException;

	/**
	 * Creates variants for a given test case. Is called after the variants
	 * generation.
	 * 
	 * @author Clement HELIOU (clement.heliou@che-software.com).
	 * @param testCaseId the test case id.
	 * @param variants the list of generated variants.
	 * @since July, 2011.
	 * @throws VariantCreationDAOException if an error occurs during the
	 *         creation.
	 */
	public void createVariantsFromTestCaseId(int testCaseId, List<VariantCreation> variants) throws VariantCreationDAOException;

	/**
	 * Variant search from a bean of criterions.
	 * 
	 * @author Clement HELIOU (clement.heliou@che-software.com).
	 * @param searchBean the criterions to use for the search.
	 * @return the resulting object list.
	 * @since July, 2011.
	 * @throws VariantSearchDAOException if an error occurs during the search.
	 */
	public List<Variant> searchVariant(VariantSearch searchBean) throws VariantSearchDAOException;

	/**
	 * Updates a variant from his object.
	 * 
	 * @author Clement HELIOU (clement.heliou@che-software.com).
	 * @param variantToUpdate the variant object to update in the database.
	 * @since July, 2011.
	 * @throws VariantUpdateDAOException if an error occurs during the update.
	 */
	public void updateVariant(Variant variantToUpdate) throws VariantUpdateDAOException;
}